﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace app
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            // api
            routes.MapRoute(
                name: "api",
                url: "api/{action1}/{action2}",
                defaults: new { controller = "Api", action = "Do", action1 = UrlParameter.Optional, action2 = UrlParameter.Optional }
            );
            routes.MapRoute(
                name: "apitest",
                url: "apitest",
                defaults: new { controller = "Api", action = "ApiTest" }
            );

            // view
            routes.MapRoute(
                name: "Default",
                url: "{view_name}",
                defaults: new { controller = "View", action = "Index", view_name = UrlParameter.Optional }
            );
        }
    }
}
